<script>
	function reloadSession() {
		sessionlist.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		sessionlist.datagrid('unselectAll');
		sessionlist.datagrid('uncheckAll');
	}
	
	//强制退出session
	function deleteSession() {
		var rows = sessionlist.datagrid('getChecked');
		printLog(rows);
	    if (rows&&rows.length>0){
	    	if(rows.length>1) {
	    		showMsg("请选择一条操作记录.");
	    		return;
	    	}
	        $.messager.confirm('询问','你确认要强制退出会话吗吗?',function(r){
	            if (r){
	                $.post('session.do?forceLogout',{sessionId:rows[0].id},function(result){
	                    if (result.success){
	                    	reloadSession();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false">
		<@eu.datagrid id="sessionlist" idField="id" toolbar="#sessionlist_toolbar"  url="session.do?loadSessions" item="com.xdtech.shiro.session.mgt.SysSession" />
		<div id="sessionlist_toolbar" style="height: auto">
			<@eu.linkbutton showName="强制退出" shiro="sys:session:delete" iconCls="icon-remove" onclick="deleteSession()"/>
			<@eu.linkbutton showName="刷新" shiro="sys:session:refresh" iconCls="icon-reload" onclick="reloadSession()"/>
		</div>
	</div>
	
</div>